<script setup>
import { inject, ref } from "vue";
import { goPage } from "@/utils/newpage";
import { formatPrice } from "@/utils/formatPrice";
import { onLoad, onReachBottom } from "@dcloudio/uni-app";
import { countApi, bonusApi } from "@/services/team";

onLoad(() => {
  bonusApiFun();
});

const user_count = ref({});

const bonusApiFun = async () => {
  try {
    let res = await bonusApi();
    user_count.value = res.data.user_count;
  } catch (e) {
    uni.showToast({
      title: e.info,
      icon: "none",
    });
  }
};
</script>
<template>
  <view class="bonus">
    <view class="bonus-bg">
      <image src="@/pages/team/static/bg-icon.png" mode="widthFix" />

      <text class="bonus-title-text">本期参与分红</text>

      <view class="bonus-title-bg">
        <image src="@/pages/team/static/title-bg.png" mode="widthFix" />
        <view class="card">
          <view class="card-list"
            ><text class="card-list-left">身份等级名称</text
            ><text class="card-list-right">人数</text></view
          >
          <view
            class="card-item"
            v-for="(item, index) in user_count"
            :key="index"
            ><text class="card-item-left">{{
              index == 301
                ? "联盟店"
                : index == 401
                ? "认证店"
                : index == 501
                ? "形象店"
                : index == 601
                ? "旗航店"
                : ""
            }}</text
            ><text class="card-item-right">{{ item }}</text></view
          >
        </view>
      </view>
    </view>
  </view>
</template>

<style lang="scss" scoped>
@import "./bonus.scss";
</style>
